package cl.movix.modules.customer.dao;

import cl.movix.modules.customer.business.Customer;
import cl.movix.modules.customer.business.IProperty;

public class EntityDAOStrategyDelegate {

	private IEntityDAO entityDAO;

	public long insert(Customer customer, IProperty property,
			RepositoryEstrategy strategy) {

		switch (strategy) {
		case LATER:
			return this.entityDAO.insertLater(customer, property);

		case NOW:
			return this.entityDAO.insertNow(customer, property);

		default:
			return 0;
		}
	}

	public long update(Customer customer, IProperty property,
			RepositoryEstrategy strategy) {

		switch (strategy) {
		case LATER:
			return this.entityDAO.updateLater(customer, property);

		case NOW:
			return this.entityDAO.updateNow(customer, property);

		default:
			return 0;
		}
	}

	public long delete(Customer customer, IProperty property,
			RepositoryEstrategy strategy) {
		switch (strategy) {
		case LATER:
			return this.entityDAO.deleteLater(customer, property);

		case NOW:
			return this.entityDAO.deleteNow(customer, property);

		default:
			return 0;
		}
	}

}
